/**
 * 
 */
package org.ranch.web.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

/**
 * 
 */
@Controller
@RequestMapping("menu")
public class MenuController {

    /**
     * Redirect to view system users
     * 
     * @param pageNo
     * @param model
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, params = { "action=view", "item=users" })
    public ModelAndView viewUsersHandler(
	    @RequestParam(value = "pageNo", required = false) Integer pageNo, ModelMap model) {
	 return new ModelAndView(new RedirectView("user?action=view&item=users"));
    }
    
    /**
     * Redirect to view system roles and permissions
     * 
     * @param pageNo
     * @param model
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, params = { "action=view", "item=roles" })
    public ModelAndView viewRoleHandler(
	    @RequestParam(value = "pageNo", required = false) Integer pageNo, ModelMap model) {
	 return new ModelAndView(new RedirectView("role?action=view&item=roles"));
    }
    
    /**
     * Redirect to view system concepts
     * 
     * @param pageNo
     * @param model
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, params = { "action=view", "item=concepts" })
    public ModelAndView viewConceptHandler(
	    @RequestParam(value = "pageNo", required = false) Integer pageNo, ModelMap model) {
	 return new ModelAndView(new RedirectView("concept?action=view&item=concepts"));
    }

    /**
     * Redirect to view system conceptCategory
     * 
     * @param pageNo
     * @param model
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, params = { "action=view", "item=conceptCategory" })
    public ModelAndView viewConceptCategoryHandler(
	    @RequestParam(value = "pageNo", required = false) Integer pageNo, ModelMap model) {
	 return new ModelAndView(new RedirectView("concept?action=view&item=conceptcategories"));
    }
    
    /**
     * Redirect to view farm report
     * 
     * @param pageNo
     * @param model
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, params = { "action=view", "item=report" })
    public ModelAndView viewReportHandler(
	    @RequestParam(value = "pageNo", required = false) Integer pageNo, ModelMap model) {
	 return new ModelAndView(new RedirectView("farm?action=view&item=report"));
    }
}
